package{
	import com.iyimo.control.YFPS;
	import com.iyimo.core.YEngine;
	import com.iyimo.event.LoadEvent;
	import com.iyimo.loader.LoaderSet;
	import com.iyimo.manager.SpriteManager;
	import com.mice.controller.AppFacade;
	import com.mice.game.GameEngine;
	import com.mice.loader.MetaLoader;
	import com.mice.loader.SpriteLoader;
	import com.mice.loader.XmlLoader;
	import com.mice.meta.MetaManager;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(width="960", height="640", frameRate="30", backGround="0x000000")]
	public class MiceClient extends Sprite{
		public function MiceClient(){
			YEngine.instance.init(this);
			
			var xl:XmlLoader = new XmlLoader();
			xl.source = [{"name": "ui", "url":"assets/conf/ui.xml"}, 
				{"name":"meta", "url":"assets/conf/meta.xml"}];
			
			var sl:SpriteLoader = new SpriteLoader();
			sl.source = SpriteManager.urlArray;
			
			var ml:MetaLoader = new MetaLoader();
			ml.source = MetaManager.urlArray;
			
			var set:LoaderSet = new LoaderSet();
			set.addEventListener(LoadEvent.ALL_COMPLETE, onComplete);
			set.load([xl, sl, ml]);
		}
		
		protected function onComplete(e:Event):void{
			GameEngine.instance.root = this;
			
			YFPS.initialize(this);
			AppFacade.instance.initialize();
		}
	}
}